package view;

import service.AdminService;
import service.StudentManagerService;

import java.util.Scanner;

//控制台界面
public class ConsoleView {
     StudentManagerService studentManagerService=new StudentManagerService();
    //登录界面
    public void loginView() {
        String adminUsername;
        String adminPassword;
        boolean islogin = false;
        while (!islogin) {
            AdminService adminService = new AdminService();
            //获取账户密码
            //获取键盘输入
            Scanner scanner = new Scanner(System.in);
            System.out.println("管理员账号：");
            adminUsername = scanner.nextLine();
            System.out.println("管理员密码：");
            adminPassword = scanner.nextLine();
            islogin = adminService.login(adminUsername, adminPassword);
            if (islogin) {
                System.out.println("登录成功");
                break;
            } else {
                System.out.println("登录失败");
                System.out.println("请重新登陆！");
                loginView();
            }

        }
        menuView();
    }
    //操作菜单界面
    public void menuView(){
        System.out.println("==========");
        System.out.println("1,新增学生");
        System.out.println("2,删除学生");
        System.out.println("3,查找学生");
        System.out.println("4,修改学生");
        System.out.println("5,退出系统");
        System.out.println("==========");
        int num=studentManagerService.selectMenuNum();
        System.out.println("用户选择了："+num);
    }
}
